|
This Comparison of programming languages compares how object-oriented programming languages such as C++, Python, Perl, Java, Object Pascal and others manipulate data structures. == Object construction and destruction == or variable := create .make_foo «(parameters)» |〔 |- | PHP | $variable = new class(parameters); | unset($variable); |- | Perl 5 | «my »$variable = class->new«(parameters)»; | undef($variable); |- | Perl 6 | «my »$variable = class.new«(parameters)»; | $variable.undefine; |- | Ruby | variable = class.new«(parameters)» |〔 |- | Windows PowerShell | $variable = New-Object «-TypeName» class ««-ArgumentList» parameters» | Remove-Variable «-Name» variable |- | OCaml | let variable = new class «parameters» or let variable = object members end〔OCaml objects can be created directly without going through a class.〕 | rowspan=2|〔 |- | F# | let variable = «new »class(«parameters») |- | Smalltalk | "The class is an Object. Just send a message to a class, usually #new or #new:, and many others, for example:" Pointy x: 10 y: 20. Array with: -1 with: 3 with: 2. | |- | JavaScript | var variable = new class«(parameters)» or var variable = |〔 |- | Object Pascal / Delphi | ClassVar := ClassType.ConstructorName(parameters); | ClassVar.Free; |- | Scala | val obj = new Object // no parameters val obj = new Object(arg0, arg1, arg2...) val obj = Object(arg0, arg1, arg2...) // case class val obj = new Object(arg0, arg1, param1 = value1, ...) // named parameters |〔 |- | COBOL | INVOKE class "NEW" RETURNING variable or | |- | Cobra | variable «as class» = class(parameters) | variable.dispose | |- | ()] | (setq variable (create (class | 〔 |} 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Comparison of programming languages (object-oriented programming)」の詳細全文を読む スポンサード リンク
|